<html>
<head><meta charset="utf-8"><title>wasm panic · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/wasm.20panic.html">wasm panic</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="211289792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/wasm%20panic/near/211289792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/wasm.20panic.html#211289792">(Sep 25 2020 at 17:41)</a>:</h4>
<p>Hey folks,<br>
I'm currently compiling some rust to wasm with wasm-pack.<br>
It's very annoying though that whenever a panic happens, It doesn't show a stack trace or even where the panic occured in the js-debugger.<br>
So it takes a lot of time to find out what actually went wrong.<br>
Any advice on how to make panics work there?</p>



<a name="211290519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/wasm%20panic/near/211290519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/wasm.20panic.html#211290519">(Sep 25 2020 at 17:46)</a>:</h4>
<p>Missed it at first, but the crate console_error_panic_hook does exactly that.</p>



<a name="211358513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/wasm%20panic/near/211358513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> panstromek <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/wasm.20panic.html#211358513">(Sep 26 2020 at 12:46)</a>:</h4>
<p>Panic hook is very useful but also in general it's better to write as much of the code outside of the browser and test it natively and then write just a  glue layer for wasm</p>



<a name="211358519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/wasm%20panic/near/211358519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> panstromek <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/wasm.20panic.html#211358519">(Sep 26 2020 at 12:46)</a>:</h4>
<p>Debugging raw wasm is possible, but pretty time consuming</p>



<a name="211358531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/wasm%20panic/near/211358531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> panstromek <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/wasm.20panic.html#211358531">(Sep 26 2020 at 12:47)</a>:</h4>
<p>Make sure you build with debug info - that will at least show correct function names in wasm</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>